﻿using StudyOnline.Models;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Web;

namespace StudyOnline.DAL
{
    public class StudyOnlineContext : DbContext
    {
        public DbSet<Instructor> Instructors { get; set; }
        public DbSet<Campus> Campuses { get; set; }
        public DbSet<City> Cities { get; set; }
        public DbSet<Department> Departments { get; set; }
        public DbSet<District> Districts { get; set; }
        public DbSet<Grade> Grades { get; set; }
        public DbSet<Instructor_Grade> Instructor_Grades { get; set; }
        public DbSet<Instructor_Location> Instructor_Locations { get; set; }
        public DbSet<Instructor_Subject> Instructor_Subjects { get; set; }
        public DbSet<Location> Locations { get; set; }
        public DbSet<Province> Provinces { get; set; }
        public DbSet<School> Schools { get; set; }
        public DbSet<School_Department> School_Department { get; set; }
        public DbSet<Subject> Subjects { get; set; }

        public StudyOnlineContext()
            : base("StudyOnlineContext")
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<StudyOnlineContext>()); 
        }


        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();

        }
    }
}